package com.atguigu.springcloud.service;

import com.atguigu.springcloud.service.impl.FeignFallBackServiceImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 输入一个实际不存在的服务名CLOUD-PAYMENT-HYSTRIX-SERVICE，模拟服务器宕机，
 * fallback代表降级配置此服务的全局降级处理方法
 *  解决orderController和GlobalFallBackController带来的代码耦合
 * @author timiv
 */
@Component
@FeignClient(value = "CLOUD-PAYMENT-HYSTRIX-SERVICE-SHOWDOWN",fallback = FeignFallBackServiceImpl.class)
public interface FeignFallBackService {

    @GetMapping("/payment/hystrix/ok/{id}")
    String payment_ok(@PathVariable("id") Integer id);
}
